package fr.ssd.jvc.io;

import java.io.File;
import java.util.LinkedList;
import java.util.List;

public class Find {

	private static ClassFileFilter cff = new ClassFileFilter();

	public static List<File> find(File dir) {
		List<File> results = new LinkedList<File>();
		File[] list = dir.listFiles(cff);
		if (list != null) {
			for (File f : list) {
				if (f.isDirectory()) {
					results.addAll(find(f));
				} else {
					results.add(f);
				}
			}
		}
		return results;
	}

	public static void main(String[] args) {
		Find finder = new Find();

		for(File f : finder.find(new File("d:/partage"))){
			System.out.println(f.getAbsolutePath());
		}
	}
}